#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


# class ClassRoom:
#     def __init__(self, cls_name):
#         self.cls_name = cls_name
#         self.students = None  # 默认设置可以设置为空
#
#     def add_stu(self, stu):
#         self.student = stu
#
#
# class Student:
#     def __init__(self, stu_name):
#         self.stu_name = stu_name
#
#
# python_1 = ClassRoom('python1班')
# stu_1 = Student('双双')
#
# # 使用班级中的学生添加函数来添加学生
# python_1.add_stu(stu_1)
#
# # 使用班级类查询学生
# print(python_1.student.stu_name)


class ClassRoom:
    def __init__(self, cls_name):
        self.cls_name = cls_name
        self.students = []  # 默认设置可以设置为空

    def add_stu(self, stu):
        self.students.append(stu)


class Student:
    def __init__(self, stu_name):
        self.stu_name = stu_name


class_boj = ClassRoom('python1班')

anna = Student('Anna')
bob = Student('Bob')
maimai = Student('Maimai')

class_boj.add_stu(anna)
class_boj.add_stu(bob)
class_boj.add_stu(maimai)

for item in class_boj.students:
    print(item.stu_name)
